<#include "/common/head.ftl">
<@head>

<div class="container">
<form >

  <div class="form-group">
    <label for="bankAddr1">支付方式</label>
        <@select id="type" datas=rechargeTypes value="" />
  </div>


 <#list rechargeInfos as data>
 <div class="form-group ${data.type} rechargeType" style="    display: none;" >

    <input type="radio" id="rechargeId${data.id}"  name="rechargeId" value="${data.id}" /> <label  for="rechargeId${data.id}">充值编号:${data.id}.收款姓名:${data.cardName!} - ${data.cardNo!} - ${data.remark!}</label>
<#if data.cardLink?? && data.cardLink!="">
    <img src="${data.cardLink!}"/>
    </#if>
  </div>

 </#list>


  <div class="form-group">
    <label for="totleMoney">充值金额</label>
    <input type="number" class="form-control" id="totleMoney" placeholder="充值金额"  name="totleMoney"  >
  </div>
  <div class="form-group">
    <label for="remark">备注</label>
    <input type="text" class="form-control" id="remark" placeholder="备注"  name="remark"  >
  </div>
   <button type="submit" class="btn btn-default">确定充值</button>
         <a class="btn btn-lg" href="/money/searchRecharge" role="button">充值记录</a>

</form>

 
</div>

    
<@js>
//-------

    $("#type").on('input',function(e){
       var type=$(this).val();

 $('.rechargeType').hide();
       $('.'+type).show();
    });


$("form").submit(function(e){
    e.preventDefault();
	$.post("/api/money/recharge", $("form").serialize(),function(data){
          console.log(data); //  2pm
         if(data.status==200){
			window.location.href='/';
         }
            alert(data.message);     
         }, "json");
    
});

          
          

</@js>

</@head>